package com.example.apiproject.task;

import com.example.apiproject.dao.ArticlesDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
//@Slf4j
@Component
public class ArticleEndTask {

    @Autowired
    private ArticlesDao articlesDao;

    /**
     * 定时任务，每天凌晨1点将寻搭成功且未结束且开始时间据今已过3天的寻搭状态设为已结束
     */
//    @Scheduled(cron = "0 0 1 * * ? ")
//    @Scheduled(cron = "0/5 * * * * ? ")
    public void processTimeoutArticle(){
//        log.info("处理超时未结束寻搭");
        LocalDateTime time = LocalDateTime.now().plusDays(-3);
//        articlesDao.endTimeoutArticle(time);
    }
}
